#define BOOST_TEST_MODULE floatingTest
#include <boost/test/included/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <cmath>

BOOST_AUTO_TEST_SUITE ( test ) 

//BOOST Test Suite forbide the compare between float and double;
//or else, it will report a compile error.
BOOST_AUTO_TEST_CASE( test )
{
  float f1 = 567.01012;
  float result = sqrt(f1); // this could be my_sqrt; faster implementation
                           // for some specific DSP like hardware

  //We can control compare precision of float/double number using the 3rd 
  //parameter of BOOST_CHECK_CLOSE_FRACTION
  BOOST_CHECK_CLOSE_FRACTION (f1, result * result, 0.0001); //Pass the check 
  BOOST_CHECK_CLOSE_FRACTION (f1, result * result, 0.0000001); //Fail the check 
}

BOOST_AUTO_TEST_SUITE_END( )

